IF OBJECT_ID('dbo.GetRptSponsorTypes') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.GetRptSponsorTypes
    IF OBJECT_ID('dbo.GetRptSponsorTypes') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.GetRptSponsorTypes >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.GetRptSponsorTypes >>>'
END
go
-- =======================================================================
-- Procedure Name: dbo.GetRptSponsorTypes
--
-- Author:      Kevin Cashman, Parallax Consulting LLC
--
-- Create date: 8/7/2007
--
-- Description: Returns list of SponsorTypes 
--             ** For now! Just 'INDUSTRY'
--
-- Parameters:  None
--              
-- Returns:     INT, 0=Success, -1=Error
--
-- SampleCall:
-- EXECUTE dbo.GetRptSponsorTypes()
--
--------------------------------------------------------------------------
-- Date        Initials  Modification
--------------------------------------------------------------------------
-- 8/7/07     KC        Created
-- 8/14/07    KC        Changed Name of Proc, Added logic to get othertypes
-- 12/11/08   CB	     Added column for infoed searches
-- =======================================================================
CREATE PROCEDURE dbo.GetRptSponsorTypes
          (@SponsorType       VARCHAR(20)=NULL)
AS
BEGIN
     /*  Returned Fields for Dropdown
     --------------------------------
     SponsorTypeId       INT             
     SponsorType         VARCHAR
     */

     -- Initial Settings
     SET NOCOUNT ON
     
     -- Declare Local Variables
     DECLARE   @Error            INT,
               @RowCount         INT

     -- Result Query    
     SELECT    Id AS SponsorTypeId,
               Name AS SponsorType,
               PSCode AS InfoEdSponTypeCode
     FROM      dbo.AdmSponsorType
     WHERE     @SponsorType IS NULL OR Name = @SponsorType
     ORDER BY Name
     
     
     SELECT @Error=@@ERROR,@RowCount=@@ROWCOUNT
     IF @Error!=0
          RETURN -1

     -- Return Success
     RETURN 0
     
END
go

IF OBJECT_ID('dbo.GetRptSponsorTypes') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.GetRptSponsorTypes >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.GetRptSponsorTypes >>>'
go

GRANT EXECUTE ON dbo.GetRptSponsorTypes TO InsightReport,Insight
go
